package 剑指offer;

import java.util.Scanner;

/**
 * @ClassName _05替换空格
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2022/2/24 20:07
 * Version 1.0
 **/
public class _05替换空格 {
    public String replaceSpace(String s) {
        StringBuffer stringBuffer = new StringBuffer();
        Scanner scanner = new Scanner(System.in);

        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == ' '){
                stringBuffer.append("%20");
            }else{
                stringBuffer.append(s.charAt(i));
            }
        }
        return stringBuffer.toString();
    }

    public static void main(String[] args) {

    }

}
